// function isAuthenticated(): boolean { return false }
// ---cut---
export default defineNuxtRouteMiddleware(async (to, from) => {
  try {
    const { data: session } = await authClient.useSession(useFetch)

    // console.log('session', session)
    // console.log('to', to)
    // console.log('from', from)

    if (!session.value) {
      return navigateTo('/login')
    }
  } catch {
    // console.error('Auth middleware error:', error)
    return navigateTo('/login')
  }
})
